<template>
	<div>
		<h3>我的课程表</h3>
		<hr >
		
		<table style="width: 90%;line-height: 36px;">
			<tr>
				<td>班级ID</td>
				<td>班级名称</td>
				<td>课程ID</td>
				<td>课程名称</td>
				<td>登分</td>
			</tr>
			<tr v-for="k in data.tasks">
				<td>{{k.clz.clzno}}</td>
				<td>{{k.clz.clzname}}</td>
				<td>{{k.course.cno}}</td>
				<td>{{k.course.cname}}</td>
				<td><button @click="go2Mark(k)">该课程登分</button></td>
			</tr>
		</table>
		
	</div>
</template>

<script setup>
	import {useRoute,useRouter} from "vue-router"
	import { ref , reactive , onMounted } from "vue"
	import {$get , $postx} from "../../ajax/index.js"
	import myalert from "../../store/index.js"
	import router from "../../router/index.js"
	
	const data = reactive({
		tasks :[],
	})
	//去登分
	const go2Mark =(task)=>{
		console.log("去登分"); console.log(task);
		router.push({
			path:'/tea/doMark',
			query : {
				clzno : task.clz.clzno,
				cno : task.course.cno
				}
		});
	}
	
	onMounted( ()=>{
		console.log("加载初始化......");
		$get("/api/fore/tea/findMyTask"
		).then((resp)=>{
			console.log(resp.data.data)
			data.tasks = resp.data.data;
		})
	})
</script>

<style>
</style>
